package com.xuebusi.common;

/**
 * Created by SYJ on 2017/11/11.
 */
public class ResultModel<T> {

    private int code;
    private String message;
    private boolean success;
    private T data;

    public ResultModel() {
    }

    public ResultModel success(T data) {
        this.code = 200;
        this.success = true;
        this.data = data;
        this.message = "成功";
        return this;
    }

    public ResultModel fail() {
        this.code = 500;
        this.success = false;
        this.data = null;
        this.message = "失败";
        return this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
